Results 1 to 7 of 7

Thread: Viewing Triggers and Spawns :: The Easy Way :: Would This Work?

  1. #1

    Default Triggers and Spawns :: Accessing Spawn Targetnames from Map Script

    First of all, this thread pertains to the last few I've posted in this forum. In order to make my life easier in attempting to bring the gain ground mod back to MOHAA, I'm thinking this is the easiest way to show both triggers and spawns. Here's my code:

    Calling a spawn:

    Code:
    local.spawn = waitexec global/push_spawn.scr 4104.78 7775.73 -211.88 -90 axh axis
    push_spawn.scr:

    Code:
    main local.x1 local.y1 local.z1 local.angle local.targName local.type:
    
        if(local.type == "allies"){
          local.allySpawn = spawn info_player_allied targetname local.targName
          local.allySpawn.origin = ( local.x1 local.y1 local.z1 )
          local.allySpawn.angle = local.angle
          
          // Debug --- Show the spawns
          if (int(getcvar(pushDebug)) == 1)
          {
            local.show1 = spawn script_model model models/player/allied_Airborne.tik origin ( local.allySpawn.origin ) angle ( local.allySpawn.angle ) 
          }
        }else if(local.type == "axis"){
          local.axisSpawn = spawn info_player_allied targetname local.targName
          local.axisSpawn.origin = ( local.x1 local.y1 local.z1 )
          local.axisSpawn.angle = local.angle
          
          // Debug --- Show the spawns
          if (int(getcvar(pushDebug)) == 1)
          {
            local.show1 = spawn script_model model models/player/german_Scientist.tik origin ( local.axisSpawn.origin ) angle ( local.axisSpawn.angle ) 
          }
        }
        
    end
    Setting a trigger:

    Code:
    local.sptrg = waitexec global/trigger.scr -3598.932 -3089.528 456.611 -3881.924 -3909.593 551.171 sptrgstart
    Trigger.scr:

    Code:
    main local.x1 local.y1 local.z1 local.x2 local.y2 local.z2 local.trigName:
    
        local.x1 = float( local.x1 ) ; local.x2 = float( local.x2 )
        local.y1 = float( local.y1 ) ; local.y2 = float( local.y2 )
        local.z1 = float( local.z1 ) ; local.z2 = float( local.z2 )
    
        // Make sure coords are in right order // Taken from MAM
        if ( local.x1 > local.x2 )
        {
            local.x = local.x1 ; local.x1 = local.x2 ; local.x2 = local.x
        }
        if ( local.y1 > local.y2 )
        {
            local.y = local.y1 ; local.y1 = local.y2 ; local.y2 = local.y
        }
        if ( local.z1 > local.z2 )
        {
            local.z = local.z1 ; local.z1 = local.z2 ; local.z2 = local.z
        }
    
        local.trigObj = spawn trigger_multiple
        local.trigObj.origin = ( local.x1 local.y1 local.z1 )
        local.trigObj setsize ( 0 0 0 ) ( ( local.x2 local.y2 local.z2 ) - ( local.x1 local.y1 local.z1 ) )
        local.trigObj targetname local.trigName
        
        // Debug --- Show the triggers
        if (int(getcvar(pushDebug)) == 1)
        {
          exec global/showbox.scr::setsize local.trigObj.origin ( 0 0 0 )( ( local.x2 local.y2 local.z2 ) - ( local.x1 local.y1 local.z1 ) )
        }
        
        
    end
    Setting the CVAR to view the triggers and spawns (in server.cfg or the actual map files itself):

    Code:
    set pushDebug 1
    Do you think this setup would work?
    Last edited by own3mall; October 12th, 2012 at 08:14 PM.

  2. #2
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    Why shouldn't it?

  3. #3

    Default

    Redid all my spawns, and now the script is messed up for some reason. I create my targetnames in the push_spawn.scr class. Can the main map script maps/m2l1.scr access these spawns by target names? It seems it does not? Should I make my script level.allySpawn?

    For example, should this code in push_spawn.scr:

    Code:
    local.axisSpawn = spawn info_player_allied targetname local.targName
    Actually be:

    Code:
    level.axisSpawn = spawn info_player_allied targetname local.targName
    Then, would the m2l1.scr be able to access the targetnames set for those spawns?
    Last edited by own3mall; October 12th, 2012 at 08:16 PM.

  4. #4

  5. #5
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    So the spawns work but not the targetnames? That's certainly weird, spawnpoint objects should've enherited the targetname command from SimpleEntity...
    Make sure you create them before level waittill prespawn; and try defining the targetname after declaring the origin and angles etc... and see if that works. I did it like this and it worked fine
    Code:
    	spawn info_player_axis "origin" "223.81 1315.44 676.13" "angle" "-84" "targetname" "X1"

  6. #6

    Default

    Quote Originally Posted by Sor View Post
    So the spawns work but not the targetnames? That's certainly weird, spawnpoint objects should've enherited the targetname command from SimpleEntity...
    Make sure you create them before level waittill prespawn; and try defining the targetname after declaring the origin and angles etc... and see if that works. I did it like this and it worked fine
    Code:
    	spawn info_player_axis "origin" "223.81 1315.44 676.13" "angle" "-84" "targetname" "X1"
    I'll give it a shot. No, my spawns did not work at all after creating them through the script. The map script references the spawn by targetname, so I assume this is the problem.

  7. #7

    Default

    Problem was right in front of my face:

    For axis, it's duh supposed to be:

    Code:
    info_player_axis
    and not

    Code:
    info_player_allies
    Sigh, I wish someone would point out the obvious to me sometimes lol. It took me a long time to see that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •